package com.easy;

/**
 * Created by Lxk on 2019/6/2.
 */
public class Solution141 {

    public boolean hasCycle(ListNode head) {
        if(head==null || head.next == null){
            return false;
        }
        ListNode faster = head,slower = head;
        while (faster != null){
            slower = slower.next;
            faster = faster.next;
            if(faster != null){
                faster = faster.next;
            }
            if(faster==slower){
                return true;
            }
        }
        return false;
    }

}
